Skip to content

Fix interval text codec only parsing default intervalstyle#165

Merged
SeanTAllen merged 1 commit intomainfrom
intervalstyle-support
Mar 15, 2026
Merged

Fix interval text codec only parsing default intervalstyle#165
SeanTAllen merged 1 commit intomainfrom
intervalstyle-support

Conversation

@SeanTAllen
Copy link
Copy Markdown
Member

_IntervalTextCodec.decode() only handled the default postgres interval style. If a user changed their PostgreSQL session's intervalstyle setting, SimpleQuery results for interval columns would fail to decode. Binary format (used by PreparedQuery and NamedPreparedQuery) was never affected.

The text codec now detects and parses all four PostgreSQL intervalstyle formats via a dispatch heuristic: leading Piso_8601, leading @postgres_verbose, any ASCII letter → postgres, otherwise sql_standard.

Also fixes a pre-existing bug where mixed-sign postgres-style intervals with + prefixed tokens (e.g., +3 days) failed because Pony's String.i64() doesn't handle + prefix (tracked separately in #164).

Closes #145

@SeanTAllen SeanTAllen added the changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge label Mar 15, 2026
@ponylang-main ponylang-main added the discuss during sync Should be discussed during an upcoming sync label Mar 15, 2026
_IntervalTextCodec.decode() only handled the default postgres interval
style. If a user changed their PostgreSQL session's intervalstyle setting,
SimpleQuery results for interval columns would fail to decode.

The text codec now detects and parses all four PostgreSQL intervalstyle
formats via a dispatch heuristic: leading P → iso_8601, leading @ →
postgres_verbose, any ASCII letter → postgres, otherwise sql_standard.

Also fixes a pre-existing bug where mixed-sign postgres-style intervals
with + prefixed tokens (e.g., +3 days) failed because Pony's String.i64()
doesn't handle + prefix.

Closes #145
@SeanTAllen SeanTAllen force-pushed the intervalstyle-support branch from 840940d to 1e4e124 Compare March 15, 2026 19:02
@SeanTAllen SeanTAllen removed the changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge label Mar 15, 2026
@SeanTAllen SeanTAllen merged commit 6482ce8 into main Mar 15, 2026
8 checks passed
@SeanTAllen SeanTAllen deleted the intervalstyle-support branch March 15, 2026 19:12
@ponylang-main ponylang-main removed the discuss during sync Should be discussed during an upcoming sync label Mar 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IntervalTextCodec only handles default postgres intervalstyle

2 participants